{block #mainTitle}Výrobci{/block}
{block #content}
<div id="dialog-confirm" style="display:none;">
    <p>
        <span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;">
        </span>Opravdu si přejete trvale odstranit výrobce a všechny jeho výrobky?
    </p>
</div>

<div id="breadcrumb">
    <span class="breadcrumb">Výrobci</span>
</div>

<a class="button-add" href="{link Vyrobci:pridat}">Přidat</a>   
<table class="data-table" n:if="count($manufacturers)">    
    <thead>
        <tr>
            <th>ID</th>
            <th>Název</th>
            <th>Sleva</th>
            <th>Akce</th>
        </tr>
    </thead>
    <tbody>        
        <tr n:foreach="$manufacturers as $manufacturer">
            <td>{$manufacturer->id_manufacturer}</td>
            <td>{$manufacturer->title}</td>
            <td>{if !empty($manufacturer->discount)}{$manufacturer->discount}%{else}žádná{/if}</td>
            <td>
                <a class="action-icon-edit" href="{link upravit $manufacturer->id_manufacturer}">upravit</a>
                <a class="action-icon-delete" href="{link smazat! $manufacturer->id_manufacturer}">smazat</a>
            </td>
        </tr>        
    </tbody>
    <script type="text/javascript">
        initButtons();
        
        $(function() {
            $(".action-icon-delete").bind('click', showModal);
            function showModal() {
                var link = this.href;                
                $('#dialog-confirm').dialog({
                        modal: true,
                        closeText: 'zavřít',
                        title: 'Smazání výrobce',
                        buttons: {
                            'Ano':function(event) {
                                event.preventDefault();
                                $.get(link);
                                $(this).dialog('close');
                            },
                            'Ne': function() {
                                $(this).dialog('close');
                            }
                        }
                });
                return false;
            };
        });
    </script>
</table>
{/block}
